SET(TARGET_NAME LibUiQt)
#PROJECT(${TARGET_NAME})
#必须要有的宏定义
ADD_DEFINITIONS (-DLIB_UI_QT_EXPORT)



	INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/${TARGET_NAME}/include)
	INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/${TARGET_NAME})
	INCLUDE_DIRECTORIES( ${PROJECT_BINARY_DIR}/${TARGET_NAME})#为了ui生成的头文件
    INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/Lib3dXML)
    INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/LibCommon)
	
	LINK_DIRECTORIES( ${PROJECT_BINARY_DIR}/lib)
    # LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/lib)

    INCLUDE_DIRECTORIES( ${QUAZIP_INCLUDE_DIR})
    link_directories(${QUAZIP_LIB_DIR})

	INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR})
	INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR}/QtCore)
	INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR}/QtWidgets)
    INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR}/QtGui)
    INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR}/QtANGLE)

	link_directories(${QT_LIB_DIR})

    INCLUDE_DIRECTORIES( ${QT_TABTOOLBAR_INCLUDE_DIR})
    LINK_DIRECTORIES( ${QT_TABTOOLBAR_LIB_DIR} )

    INCLUDE_DIRECTORIES( ${SPDLOG_INCLUDE_DIR})
    LINK_DIRECTORIES( ${SPDLOG_LIB_DIR} )

    INCLUDE_DIRECTORIES(Qt5Widgets_INCLUDE_DIRS)
find_package(Qt5Widgets)
ADD_DEFINITIONS (${Qt5Widgets_DEFINITIONS})

FILE(GLOB_RECURSE ThisTarget_INCLUDE_LIST 
    "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/*.h"
    "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/WidgetBox/*.h"
    )
FILE(GLOB_RECURSE ThisTarget_SRC_LIST 
    "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/*.cpp"
    "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/WidgetBox/*.cpp"
    )

FILE(GLOB QTDEMO_UI_LIST "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/*.ui")
FILE(GLOB QTDEMO_RESOURCE_LIST "${PROJECT_SOURCE_DIR}/${TARGET_NAME}/*.qrc")

source_group("include" FILES ${ThisTarget_INCLUDE_LIST})
source_group("src" FILES ${ThisTarget_SRC_LIST})
source_group("ui" FILES ${QTDEMO_UI_LIST})
source_group("resource" FILES ${QTDEMO_RESOURCE_LIST})

qt5_wrap_cpp(example_MOCS 	${ThisTarget_INCLUDE_LIST})
QT5_WRAP_UI(example_UIS ${QTDEMO_UI_LIST} )#OPTIONS("uic -help")
qt5_add_resources(example_RCC_SRCS ${QTDEMO_RESOURCE_LIST} )#OPTIONS("rcc -help")
source_group("generated_file" FILES ${example_MOCS} ${example_UIS} ${example_RCC_SRCS} )

# ADD_EXECUTABLE(${TARGET_NAME} ${ThisTarget_SRC_LIST} ${ThisTarget_INCLUDE_LIST} ${example_MOCS}  ${example_UIS}  ${example_RCC_SRCS} ${QTDEMO_UI_LIST} ${QTDEMO_RESOURCE_LIST}  )#${example_MOCS_Share}
ADD_LIBRARY(${TARGET_NAME} SHARED ${ThisTarget_SRC_LIST} ${ThisTarget_INCLUDE_LIST} ${example_MOCS}  ${example_UIS}  ${example_RCC_SRCS} ${QTDEMO_UI_LIST} ${QTDEMO_RESOURCE_LIST}  )#${example_MOCS_Share}

IF (UNIX)
    SET(ADDITIONAL_LIBRARIES_RELEASE
            Qt5Widgets
            Qt5Core
            Qt5Gui
            # Qt5OpenGL
            Qt5PrintSupport
            LibCommon
            # TabToolbar
        )
    SET(ADDITIONAL_LIBRARIES_DEBUG
            Qt5Widgets
            Qt5Core
            Qt5Gui
            # Qt5OpenGL
            Qt5PrintSupport
            LibCommon
            # quazip1-qt5d
            # TabToolbard
        )
ELSEIF(WIN32)
    SET(ADDITIONAL_LIBRARIES_RELEASE
            Qt5Widgets
            Qt5Core
            Qt5Gui
            Qt5OpenGL
            Qt5PrintSupport
            LibCommon
            # TabToolbar
        )
    SET(ADDITIONAL_LIBRARIES_DEBUG
            Qt5Widgetsd
            Qt5Cored
            Qt5Guid
            Qt5OpenGLd
            Qt5PrintSupportd
            LibCommond
            # quazip1-qt5d
            # TabToolbard
        )
ELSE()
ENDIF()

TARGET_LINK_LIBRARIES(${TARGET_NAME} ${QT_LIBRARIES})

TARGET_LINK_LIBRARIES(${TARGET_NAME} PRIVATE debug "${ADDITIONAL_LIBRARIES_DEBUG}" PRIVATE "${ADDITIONAL_LIBRARIES_RELEASE}")
set_target_properties(${TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}/bin)
set_target_properties(${TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/bin)
set_target_properties(${TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${PROJECT_BINARY_DIR}/bin)
#set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:CONSOLE /ENTRY:mainCRTStartup")# WINDOWS

set_target_properties(${TARGET_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/lib)
set_target_properties(${TARGET_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR}/lib)



